package com.wn.class30.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * allorder
 * @author 
 */
public class Allorder implements Serializable {
    /**
     * 总订单id
     */
    private Integer allorderId;

    /**
     * 总订单价格
     */
    private Double alltotalprice;

    /**
     * 用户地址id
     */
    private Integer userAddressId;

    /**
     * 创建时间
     */
    @JsonFormat(shape=JsonFormat.Shape.STRING,pattern="yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date allCreatetime;

    /**
     * 总订单编号
     */
    private String allorderNumber;

    /**
     * 用户id
     */
    private Integer userId;

    /**
     * 优惠券id,只能一张,一个总订单
     */
    private Integer userCuponId;

    /**
     * 订单原价（未使用优惠券的金额）
     */
    private Double allorderOriginalprice;

    /**
     * 子订单对象
     */
    private List<Myorder> myorders;

    /**
     * 优惠券对象
     */
    private Cupon cupon;

    private User user;

    private UserAddress userAddress;

    private static final long serialVersionUID = 1L;

    public List<Myorder> getMyorders() {
        return myorders;
    }

    public void setMyorders(List<Myorder> myorders) {
        this.myorders = myorders;
    }

    public Cupon getCupon() {
        return cupon;
    }

    public void setCupon(Cupon cupon) {
        this.cupon = cupon;
    }

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    public UserAddress getUserAddress() {
        return userAddress;
    }

    public void setUserAddress(UserAddress userAddress) {
        this.userAddress = userAddress;
    }

    public Integer getAllorderId() {
        return allorderId;
    }

    public void setAllorderId(Integer allorderId) {
        this.allorderId = allorderId;
    }

    public Double getAlltotalprice() {
        return alltotalprice;
    }

    public void setAlltotalprice(Double alltotalprice) {
        this.alltotalprice = alltotalprice;
    }

    public Integer getUserAddressId() {
        return userAddressId;
    }

    public void setUserAddressId(Integer userAddressId) {
        this.userAddressId = userAddressId;
    }

    public Date getAllCreatetime() {
        return allCreatetime;
    }

    public void setAllCreatetime(Date allCreatetime) {
        this.allCreatetime = allCreatetime;
    }

    public String getAllorderNumber() {
        return allorderNumber;
    }

    public void setAllorderNumber(String allorderNumber) {
        this.allorderNumber = allorderNumber;
    }

    public Integer getUserId() {
        return userId;
    }

    public void setUserId(Integer userId) {
        this.userId = userId;
    }

    public Integer getUserCuponId() {
        return userCuponId;
    }

    public void setUserCuponId(Integer userCuponId) {
        this.userCuponId = userCuponId;
    }

    public Double getAllorderOriginalprice() {
        return allorderOriginalprice;
    }

    public void setAllorderOriginalprice(Double allorderOriginalprice) {
        this.allorderOriginalprice = allorderOriginalprice;
    }

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        Allorder other = (Allorder) that;
        return (this.getAllorderId() == null ? other.getAllorderId() == null : this.getAllorderId().equals(other.getAllorderId()))
            && (this.getAlltotalprice() == null ? other.getAlltotalprice() == null : this.getAlltotalprice().equals(other.getAlltotalprice()))
            && (this.getUserAddressId() == null ? other.getUserAddressId() == null : this.getUserAddressId().equals(other.getUserAddressId()))
            && (this.getAllCreatetime() == null ? other.getAllCreatetime() == null : this.getAllCreatetime().equals(other.getAllCreatetime()))
            && (this.getAllorderNumber() == null ? other.getAllorderNumber() == null : this.getAllorderNumber().equals(other.getAllorderNumber()))
            && (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()))
            && (this.getUserCuponId() == null ? other.getUserCuponId() == null : this.getUserCuponId().equals(other.getUserCuponId()))
            && (this.getAllorderOriginalprice() == null ? other.getAllorderOriginalprice() == null : this.getAllorderOriginalprice().equals(other.getAllorderOriginalprice()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getAllorderId() == null) ? 0 : getAllorderId().hashCode());
        result = prime * result + ((getAlltotalprice() == null) ? 0 : getAlltotalprice().hashCode());
        result = prime * result + ((getUserAddressId() == null) ? 0 : getUserAddressId().hashCode());
        result = prime * result + ((getAllCreatetime() == null) ? 0 : getAllCreatetime().hashCode());
        result = prime * result + ((getAllorderNumber() == null) ? 0 : getAllorderNumber().hashCode());
        result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
        result = prime * result + ((getUserCuponId() == null) ? 0 : getUserCuponId().hashCode());
        result = prime * result + ((getAllorderOriginalprice() == null) ? 0 : getAllorderOriginalprice().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", allorderId=").append(allorderId);
        sb.append(", alltotalprice=").append(alltotalprice);
        sb.append(", userAddressId=").append(userAddressId);
        sb.append(", allCreatetime=").append(allCreatetime);
        sb.append(", allorderNumber=").append(allorderNumber);
        sb.append(", userId=").append(userId);
        sb.append(", userCuponId=").append(userCuponId);
        sb.append(", allorderOriginalprice=").append(allorderOriginalprice);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}